package com.hyg.module_report.adapter;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.hyg.module_report.R;
import com.hyg.module_report.databinding.ItemAdviceContentListBinding;
import com.hyg.module_report.model.V2AdviceDetailData;

import java.util.List;

/**
 * @author: Administrator
 * @date: 2021/1/4
 */
public class V2AdviceContentTextAdapter extends RecyclerView.Adapter<V2AdviceContentTextAdapter.AdviceViewHolder>{
    List<V2AdviceDetailData> list;
    ItemAdviceContentListBinding binding;

    public V2AdviceContentTextAdapter(List<V2AdviceDetailData> list) {
        this.list = list;
    }

    @NonNull
    @Override
    public AdviceViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_advice_content_list, parent, false);
        AdviceViewHolder holder = new AdviceViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull AdviceViewHolder holder, int position) {
        binding.tvTitle.setText(list.get(position).getYsName()+":");
        binding.tvContent.setText(list.get(position).getEffect());
    }

    @Override
    public int getItemCount() {
        return list.size();
    }


    public class AdviceViewHolder extends RecyclerView.ViewHolder {
        public AdviceViewHolder(@NonNull View itemView) {
            super(itemView);
            binding = ItemAdviceContentListBinding.bind(itemView);
        }
    }

}
